package com.wasu;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.http.client.OkHttp3ClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;

// 发现服务,即从 Eureka 中获取服务
@EnableDiscoveryClient
@SpringBootApplication
public class CloudUserclintApplication {

	public static void main(String[] args) {
		SpringApplication.run(CloudUserclintApplication.class, args);
	}
	
	@Bean
	// 负载均衡
	@LoadBalanced
	public RestTemplate restTemplate() {
		return new  RestTemplate(new OkHttp3ClientHttpRequestFactory());
	}
}
